package education.service.impl;

import java.util.List;

import javax.annotation.Resource;

import org.springframework.stereotype.Component;

import education.dao.AdminDao;
import education.exception.ServiceException;
import education.model.Admin;
import education.service.AdminManager;

@Component("adminManager")
public class AdminManagerImpl implements AdminManager{

	private AdminDao adminDao;
	
	public AdminDao getAdminDao() throws ServiceException{
		return adminDao;
	}
	
	@Resource(name="adminDao")
	public void setAdminDao(AdminDao adminDao) throws ServiceException{
		this.adminDao = adminDao;
	}

	public void delete(Admin admin) throws ServiceException{
		this.adminDao.delete(admin);
	}

	public boolean delete(int id) throws ServiceException{
		return adminDao.delete(id);
	}

	public int getCount() throws ServiceException{
		return this.adminDao.getCount();
	}

	public Admin loadById(int id) throws ServiceException{
		return adminDao.loadById(id);
	}

	public List<Admin> paging(int pageSize, int pageCount, int rowCount) throws ServiceException{
		return this.adminDao.paging(pageSize, pageCount, rowCount);
	}

	public void save(Admin admin) throws ServiceException{
		adminDao.save(admin);
	}

	public boolean update(Admin admin) throws ServiceException{
		return this.adminDao.update(admin);
	}

	public Admin findByName(String userName) throws ServiceException{
		return adminDao.findByName(userName);
	}

}
